home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 November / Maximum CD 2000 Nov.iso / AofE-Conquerers / age2xtrial.exe / CABFILE / MSGAME.CAB / Data / gamedata_x1.drs / Unnamed File 000004.bina < prev    next >
Text File  |  2000-07-18  |  54KB  |  2,884 lines

  1. ;goals 1 and 2 = boats
  2. ;goal 3 = groups
  3. ;goal combat-arm = his unique unit type (also loads correct upgrades)
  4. ;goal 36 = good infantry -- 36 NO = don't build, YES = build, 
  5. ;    2 = only build if we don't have a castle. 
  6. ;goal 37 = good cavalry
  7. ;goal 38 = good horse-archers
  8. ;goal 39 = good archers
  9.  
  10. ;starting goals
  11. (defrule
  12.     (true)
  13. =>
  14.     (set-goal military-parity YES)    ;goal 3
  15.     (set-goal attack-control NO)    ;goal 4
  16.     (set-goal need-deathmatch-villagers NO)    ;goal 7
  17.  
  18.     (set-goal secondary-build 1)    ;goal 8
  19.     (set-goal soldiers-available NO);goal 10
  20.     (set-goal attack-enabled YES)    ;goal 13
  21.     (set-goal age-advancement NO)    ;goal 14
  22.  
  23.     (set-goal make-warboat NO)        ;goal 15
  24.     (set-goal upgrade-conflict NO)    ;goal 16
  25.  
  26.     (disable-self)
  27. )
  28.  
  29. (defrule
  30.     (true)
  31. =>
  32.     (set-goal pre-unique-arm NO)    ;goal 17
  33.     (set-goal wonder-attempt MAYBE)    ;goal 20
  34.     (set-goal sea-owner NO)            ;goal 23
  35.     (set-goal enemy-soldiers NO)    ;goal 26
  36.     (set-goal siege-available YES)    ;goal 34
  37.     (disable-self)
  38. )
  39.  
  40. ;*********************************************************
  41. #load-if-defined AZTEC-CIV
  42. ;train jaguar men, eagle men, champs, arbalests
  43. (defrule
  44.     (goal combat-arm NOTICE)
  45. =>
  46.     (set-goal combat-arm INFANTRY)
  47.     (set-goal monk-rating GOOD)
  48.     (set-goal 36 2)
  49.     (set-goal 37 NO)
  50.     (set-goal 38 NO)
  51.     (set-goal 39 YES)
  52.  
  53.     (set-strategic-number sn-wood-gatherer-percentage 20)
  54.     (set-strategic-number sn-food-gatherer-percentage 50)
  55.     (set-strategic-number sn-gold-gatherer-percentage 25)
  56.     (set-strategic-number sn-stone-gatherer-percentage 5)
  57.     (disable-self)
  58. )
  59.  
  60. (defrule
  61.     (goal secondary-build 1)
  62. =>
  63.     (generate-random-number 2)
  64. )
  65.  
  66. (defrule
  67.     (goal secondary-build 1)
  68.     (random-number == 1)
  69.     (can-train elite-eagle-warrior)
  70.     (or
  71.         (population < deathmatch-unit-max)
  72.         (and
  73.             (population < unit-max)
  74.             (goal need-deathmatch-villagers NO)
  75.         )
  76.     )
  77. =>
  78.     (train elite-eagle-warrior)
  79.     (set-goal secondary-build 0)
  80. )
  81.  
  82. (defrule
  83.     (goal secondary-build 1)
  84.     (random-number == 2)
  85.     (can-train arbalest)
  86.     (or
  87.         (population < deathmatch-unit-max)
  88.         (and
  89.             (population < unit-max)
  90.             (goal need-deathmatch-villagers NO)
  91.         )
  92.     )
  93. =>
  94.     (train arbalest)
  95.     (set-goal secondary-build 0)
  96. )
  97. #end-if
  98. ;*********************************************************
  99. #load-if-defined HUN-CIV
  100. ;train tarkans, paladins, light cav, heavy cav archers
  101. (defrule
  102.     (goal combat-arm NOTICE)
  103. =>
  104.     (set-goal combat-arm CAVALRY)
  105.     (set-goal monk-rating FAIR)
  106.     (set-goal 36 NO)
  107.     (set-goal 37 2)
  108.     (set-goal 38 YES)
  109.     (set-goal 39 NO)
  110.  
  111.     (set-strategic-number sn-wood-gatherer-percentage 20)
  112.     (set-strategic-number sn-food-gatherer-percentage 35)
  113.     (set-strategic-number sn-gold-gatherer-percentage 35)
  114.     (set-strategic-number sn-stone-gatherer-percentage 10)
  115.     (disable-self)
  116. )
  117.  
  118. (defrule
  119.     (goal secondary-build 1)
  120. =>
  121.     (generate-random-number 2)
  122. )
  123.  
  124. (defrule
  125.     (goal secondary-build 1)
  126.     (random-number == 1)
  127.     (can-train heavy-cavalry-archer)
  128.     (or
  129.         (population < deathmatch-unit-max)
  130.         (and
  131.             (population < unit-max)
  132.             (goal need-deathmatch-villagers NO)
  133.         )
  134.     )
  135. =>
  136.     (train heavy-cavalry-archer)
  137.     (set-goal secondary-build 0)
  138. )
  139.  
  140. (defrule
  141.     (goal secondary-build 1)
  142.     (random-number == 2)
  143.     (can-train hussar)
  144.     (nor 
  145.         (can-train elite-tarkan)
  146.         (can-train paladin)
  147.     )
  148.     (or
  149.         (population < deathmatch-unit-max)
  150.         (and
  151.             (population < unit-max)
  152.             (goal need-deathmatch-villagers NO)
  153.         )
  154.     )
  155. =>
  156.     (train hussar)
  157.     (set-goal secondary-build 0)
  158. )
  159.  
  160. #end-if
  161. ;*********************************************************
  162. #load-if-defined KOREAN-CIV
  163. ;train war-wagons, hand-cannoneers, heavy cav archers
  164. (defrule
  165.     (goal combat-arm NOTICE)
  166. =>
  167.     (set-goal combat-arm CAVARCHER)
  168.     (set-goal monk-rating FAIR)
  169.     (set-goal 36 NO)
  170.     (set-goal 37 NO)
  171.     (set-goal 38 2)
  172.     (set-goal 39 YES)
  173.  
  174.     (set-strategic-number sn-wood-gatherer-percentage 25)
  175.     (set-strategic-number sn-food-gatherer-percentage 35)
  176.     (set-strategic-number sn-gold-gatherer-percentage 35)
  177.     (set-strategic-number sn-stone-gatherer-percentage 5)
  178.     (disable-self)
  179. )
  180.  
  181. (defrule
  182.     (goal secondary-build 1)
  183. =>
  184.     (generate-random-number 2)
  185. )
  186.  
  187. (defrule
  188.     (goal secondary-build 1)
  189.     (random-number == 1)
  190.     (can-train heavy-cavalry-archer)
  191.     (or
  192.         (population < deathmatch-unit-max)
  193.         (and
  194.             (population < unit-max)
  195.             (goal need-deathmatch-villagers NO)
  196.         )
  197.     )
  198. =>
  199.     (train heavy-cavalry-archer)
  200.     (set-goal secondary-build 0)
  201. )
  202.  
  203. (defrule
  204.     (goal secondary-build 1)
  205.     (random-number == 2)
  206.     (can-train hand-cannoneer)
  207.     (or
  208.         (population < deathmatch-unit-max)
  209.         (and
  210.             (population < unit-max)
  211.             (goal need-deathmatch-villagers NO)
  212.         )
  213.     )
  214. =>
  215.     (train hand-cannoneer)
  216.     (set-goal secondary-build 0)
  217. )
  218.  
  219. #end-if
  220. ;*********************************************************
  221. #load-if-defined MAYAN-CIV
  222. ;train plumed archers, elite-eagle-warriors, champs, arbalests
  223. (defrule
  224.     (goal combat-arm NOTICE)
  225. =>
  226.     (set-goal combat-arm ARCHER)
  227.     (set-goal monk-rating FAIR)
  228.     (set-goal 36 YES)
  229.     (set-goal 37 NO)
  230.     (set-goal 38 NO)
  231.     (set-goal 39 2)
  232.  
  233.     (set-strategic-number sn-wood-gatherer-percentage 25)
  234.     (set-strategic-number sn-food-gatherer-percentage 35)
  235.     (set-strategic-number sn-gold-gatherer-percentage 35)
  236.     (set-strategic-number sn-stone-gatherer-percentage 5)
  237.     (disable-self)
  238. )
  239.  
  240. (defrule
  241.     (goal secondary-build 1)
  242. =>
  243.     (generate-random-number 2)
  244. )
  245.  
  246. (defrule
  247.     (goal secondary-build 1)
  248.     (random-number == 1)
  249.     (can-train champion)
  250.     (or
  251.         (population < deathmatch-unit-max)
  252.         (and
  253.             (population < unit-max)
  254.             (goal need-deathmatch-villagers NO)
  255.         )
  256.     )
  257. =>
  258.     (train champion)
  259.     (set-goal secondary-build 0)
  260. )
  261.  
  262. (defrule
  263.     (goal secondary-build 1)
  264.     (random-number == 2)
  265.     (can-train elite-eagle-warrior)
  266.     (or
  267.         (population < deathmatch-unit-max)
  268.         (and
  269.             (population < unit-max)
  270.             (goal need-deathmatch-villagers NO)
  271.         )
  272.     )
  273. =>
  274.     (train elite-eagle-warrior)
  275.     (set-goal secondary-build 0)
  276. )
  277.  
  278. #end-if
  279. ;*********************************************************
  280. #load-if-defined SPANISH-CIV
  281. ;train conquistadors, champs, paladins, hussars, handgunners, hvy cav archers
  282. (defrule
  283.     (goal combat-arm NOTICE)
  284. =>
  285.     (set-goal combat-arm CAVARCHER)
  286.     (set-goal monk-rating GOOD)
  287.     (set-goal 36 YES)
  288.     (set-goal 37 YES)
  289.     (set-goal 38 YES)
  290.     (set-goal 39 NO)
  291.  
  292.     (set-strategic-number sn-wood-gatherer-percentage 20)
  293.     (set-strategic-number sn-food-gatherer-percentage 35)
  294.     (set-strategic-number sn-gold-gatherer-percentage 35)
  295.     (set-strategic-number sn-stone-gatherer-percentage 10)
  296.     (disable-self)
  297. )
  298.  
  299. (defrule
  300.     (goal secondary-build 1)
  301. =>
  302.     (generate-random-number 5)
  303. )
  304.  
  305. (defrule
  306.     (goal secondary-build 1)
  307.     (random-number == 1)
  308.     (can-train champion)
  309.     (or
  310.         (population < deathmatch-unit-max)
  311.         (and
  312.             (population < unit-max)
  313.             (goal need-deathmatch-villagers NO)
  314.         )
  315.     )
  316. =>
  317.     (train champion)
  318.     (set-goal secondary-build 0)
  319. )
  320.  
  321. (defrule
  322.     (goal secondary-build 1)
  323.     (random-number == 2)
  324.     (can-train paladin)
  325.     (or
  326.         (population < deathmatch-unit-max)
  327.         (and
  328.             (population < unit-max)
  329.             (goal need-deathmatch-villagers NO)
  330.         )
  331.     )
  332. =>
  333.     (train paladin)
  334.     (set-goal secondary-build 0)
  335. )
  336.  
  337. (defrule
  338.     (goal secondary-build 1)
  339.     (random-number == 3)
  340.     (can-train hussar)
  341.     (not (can-train paladin) )
  342.     (or
  343.         (population < deathmatch-unit-max)
  344.         (and
  345.             (population < unit-max)
  346.             (goal need-deathmatch-villagers NO)
  347.         )
  348.     )
  349. =>
  350.     (train hussar)
  351.     (set-goal secondary-build 0)
  352. )
  353.  
  354. (defrule
  355.     (goal secondary-build 1)
  356.     (random-number == 4)
  357.     (can-train hand-cannoneer)
  358.     (nor 
  359.         (can-train elite-conquistador) 
  360.         (can-train heavy-cavalry-archer)
  361.     )
  362.     (or
  363.         (population < deathmatch-unit-max)
  364.         (and
  365.             (population < unit-max)
  366.             (goal need-deathmatch-villagers NO)
  367.         )
  368.     )
  369. =>
  370.     (train hand-cannoneer)
  371.     (set-goal secondary-build 0)
  372. )
  373.  
  374. (defrule
  375.     (goal secondary-build 1)
  376.     (random-number == 5)
  377.     (can-train heavy-cavalry-archer)
  378.     (not (can-train elite-conquistador) )
  379.     (or
  380.         (population < deathmatch-unit-max)
  381.         (and
  382.             (population < unit-max)
  383.             (goal need-deathmatch-villagers NO)
  384.         )
  385.     )
  386. =>
  387.     (train heavy-cavalry-archer)
  388.     (set-goal secondary-build 0)
  389. )
  390.  
  391. #end-if
  392. ;*********************************************************
  393. #load-if-defined BRITON-CIV
  394. ;train longbows, champs, lt cav
  395. (defrule
  396.     (goal combat-arm NOTICE)
  397. =>
  398.     (set-goal combat-arm ARCHER)
  399.     (set-goal monk-rating GOOD)
  400.     (set-goal 36 YES)
  401.     (set-goal 37 NO)
  402.     (set-goal 38 YES)
  403.     (set-goal 39 2)
  404.  
  405.     (set-strategic-number sn-wood-gatherer-percentage 35)
  406.     (set-strategic-number sn-food-gatherer-percentage 25)
  407.     (set-strategic-number sn-gold-gatherer-percentage 35)
  408.     (set-strategic-number sn-stone-gatherer-percentage 5)
  409.     (disable-self)
  410. )
  411.  
  412. (defrule
  413.     (goal secondary-build 1)
  414. =>
  415.     (generate-random-number 2)
  416. )
  417.  
  418. (defrule
  419.     (goal secondary-build 1)
  420.     (random-number == 1)
  421.     (can-train champion)
  422.     (or
  423.         (population < deathmatch-unit-max)
  424.         (and
  425.             (population < unit-max)
  426.             (goal need-deathmatch-villagers NO)
  427.         )
  428.     )
  429. =>
  430.     (train champion)
  431.     (set-goal secondary-build 0)
  432. )
  433.  
  434. (defrule
  435.     (goal secondary-build 1)
  436.     (random-number == 2)
  437.     (can-train hussar)
  438.     (or
  439.         (population < deathmatch-unit-max)
  440.         (and
  441.             (population < unit-max)
  442.             (goal need-deathmatch-villagers NO)
  443.         )
  444.     )
  445. =>
  446.     (train hussar)
  447.     (set-goal secondary-build 0)
  448. )
  449. #end-if
  450. ;*********************************************************
  451. #load-if-defined BYZANTINE-CIV
  452. ;train cataphracts, hvy HA, arbalests, handgunners
  453. (defrule
  454.     (true)
  455. =>
  456.     (set-goal combat-arm CAVALRY)
  457.     (set-goal monk-rating GOOD)
  458.     (set-goal 36 YES)
  459.     (set-goal 37 2)
  460.     (set-goal 38 YES)
  461.     (set-goal 39 YES)
  462.  
  463.     (set-strategic-number sn-wood-gatherer-percentage 20)
  464.     (set-strategic-number sn-food-gatherer-percentage 35)
  465.     (set-strategic-number sn-gold-gatherer-percentage 35)
  466.     (set-strategic-number sn-stone-gatherer-percentage 10)
  467.     (disable-self)
  468. )
  469.  
  470. (defrule
  471.     (goal secondary-build 1)
  472. =>
  473.     (generate-random-number 3)
  474. )
  475.  
  476. (defrule
  477.     (goal secondary-build 1)
  478.     (random-number == 1)
  479.     (can-train heavy-cavalry-archer)
  480.     (or
  481.         (population < deathmatch-unit-max)
  482.         (and
  483.             (population < unit-max)
  484.             (goal need-deathmatch-villagers NO)
  485.         )
  486.     )
  487. =>
  488.     (train heavy-cavalry-archer)
  489.     (set-goal secondary-build 0)
  490. )
  491.  
  492. (defrule
  493.     (goal secondary-build 1)
  494.     (random-number == 2)
  495.     (or
  496.         (can-train hand-cannoneer)
  497.         (can-train arbalest)
  498.     )
  499.     (or
  500.         (population < deathmatch-unit-max)
  501.         (and
  502.             (population < unit-max)
  503.             (goal need-deathmatch-villagers NO)
  504.         )
  505.     )
  506. =>
  507.     (train hand-cannoneer)
  508.     (train arbalest)
  509.     (set-goal secondary-build 0)
  510. )
  511.  
  512. (defrule
  513.     (goal secondary-build 1)
  514.     (random-number == 3)
  515.     (can-train hussar)
  516.     (nor
  517.         (can-train elite-cataphract)
  518.         (can-train paladin)
  519.     )
  520.     (or
  521.         (population < deathmatch-unit-max)
  522.         (and
  523.             (population < unit-max)
  524.             (goal need-deathmatch-villagers NO)
  525.         )
  526.     )
  527. =>
  528.     (train hussar)
  529.     (set-goal secondary-build 0)
  530. )
  531.  
  532. #end-if
  533. ;************************************************
  534. #load-if-defined CELTIC-CIV
  535. ;train woad raiders, paladins, lt cav, hvy HA, hvy scorps
  536. (defrule
  537.     (true)
  538. =>
  539.     (set-goal combat-arm INFANTRY)
  540.     (set-goal monk-rating POOR)
  541.     (set-goal 36 2)
  542.     (set-goal 37 YES)
  543.     (set-goal 38 YES)
  544.     (set-goal 39 NO)
  545.  
  546.     (set-strategic-number sn-wood-gatherer-percentage 20)
  547.     (set-strategic-number sn-food-gatherer-percentage 50)
  548.     (set-strategic-number sn-gold-gatherer-percentage 25)
  549.     (set-strategic-number sn-stone-gatherer-percentage 5)
  550.     (disable-self)
  551. )
  552.  
  553. (defrule
  554.     (goal secondary-build 1)
  555. =>
  556.     (generate-random-number 4)
  557. )
  558.  
  559. (defrule
  560.     (goal secondary-build 1)
  561.     (random-number == 1)
  562.     (can-train paladin)
  563.     (or
  564.         (population < deathmatch-unit-max)
  565.         (and
  566.             (population < unit-max)
  567.             (goal need-deathmatch-villagers NO)
  568.         )
  569.     )
  570. =>
  571.     (train paladin)
  572.     (set-goal secondary-build 0)
  573. )
  574.  
  575. (defrule
  576.     (goal secondary-build 1)
  577.     (random-number == 2)
  578.     (can-train light-cavalry)
  579.     (not (can-afford-unit paladin) )
  580.     (or
  581.         (population < deathmatch-unit-max)
  582.         (and
  583.             (population < unit-max)
  584.             (goal need-deathmatch-villagers NO)
  585.         )
  586.     )
  587. =>
  588.     (train light-cavalry)
  589.     (set-goal secondary-build 0)
  590. )
  591.  
  592. (defrule
  593.     (goal secondary-build 1)
  594.     (random-number == 3)
  595.     (can-train heavy-cavalry-archer)
  596.     (or
  597.         (population < deathmatch-unit-max)
  598.         (and
  599.             (population < unit-max)
  600.             (goal need-deathmatch-villagers NO)
  601.         )
  602.     )
  603. =>
  604.     (train heavy-cavalry-archer)
  605.     (set-goal secondary-build 0)
  606. )
  607.  
  608. (defrule
  609.     (goal secondary-build 1)
  610.     (random-number == 4)
  611.     (can-train heavy-scorpion)
  612.     (or
  613.         (population < deathmatch-unit-max)
  614.         (and
  615.             (population < unit-max)
  616.             (goal need-deathmatch-villagers NO)
  617.         )
  618.     )
  619. =>
  620.     (train heavy-scorpion)
  621.     (set-goal secondary-build 0)
  622. )
  623.  
  624. #end-if
  625. ;********************************
  626. #load-if-defined CHINESE-CIV
  627. ;train chu-ko-nu, champs, light cav, hvy scorps; 
  628. (defrule
  629.     (true)
  630. =>
  631.     (set-goal combat-arm ARCHER)
  632.     (set-goal monk-rating FAIR)
  633.     (set-goal 36 YES)
  634.     (set-goal 37 NO)
  635.     (set-goal 38 YES)
  636.     (set-goal 39 2)
  637.  
  638.     (set-strategic-number sn-wood-gatherer-percentage 35)
  639.     (set-strategic-number sn-food-gatherer-percentage 25)
  640.     (set-strategic-number sn-gold-gatherer-percentage 35)
  641.     (set-strategic-number sn-stone-gatherer-percentage 5)
  642.     (disable-self)
  643. )
  644.  
  645. (defrule
  646.     (goal secondary-build 1)
  647. =>
  648.     (generate-random-number 3)
  649. )
  650.  
  651. (defrule
  652.     (goal secondary-build 1)
  653.     (random-number == 1)
  654.     (can-train champion)
  655.     (or
  656.         (population < deathmatch-unit-max)
  657.         (and
  658.             (population < unit-max)
  659.             (goal need-deathmatch-villagers NO)
  660.         )
  661.     )
  662. =>
  663.     (train champion)
  664.     (set-goal secondary-build 0)
  665. )
  666.  
  667. (defrule
  668.     (goal secondary-build 1)
  669.     (random-number == 2)
  670.     (can-train hussar)
  671.     (or
  672.         (population < deathmatch-unit-max)
  673.         (and
  674.             (population < unit-max)
  675.             (goal need-deathmatch-villagers NO)
  676.         )
  677.     )
  678. =>
  679.     (train hussar)
  680.     (set-goal secondary-build 0)
  681. )
  682.  
  683. (defrule
  684.     (goal secondary-build 1)
  685.     (random-number == 3)
  686.     (can-train heavy-scorpion)
  687.     (or
  688.         (population < deathmatch-unit-max)
  689.         (and
  690.             (population < unit-max)
  691.             (goal need-deathmatch-villagers NO)
  692.         )
  693.     )
  694. =>
  695.     (train heavy-scorpion)
  696.     (set-goal secondary-build 0)
  697. )
  698. #end-if
  699. ;*******************************
  700. #load-if-defined FRANKISH-CIV
  701. ;train throwing-axe, paladins, lt cav, hvy HA, hvy scorps
  702. (defrule
  703.     (true)
  704. =>
  705.     (set-goal combat-arm INFANTRY)
  706.     (set-goal monk-rating FAIR)
  707.     (set-goal 36 2)
  708.     (set-goal 37 YES)
  709.     (set-goal 38 YES)
  710.     (set-goal 39 NO)
  711.  
  712.     (set-strategic-number sn-wood-gatherer-percentage 20)
  713.     (set-strategic-number sn-food-gatherer-percentage 50)
  714.     (set-strategic-number sn-gold-gatherer-percentage 25)
  715.     (set-strategic-number sn-stone-gatherer-percentage 5)
  716.     (disable-self)
  717. )
  718.  
  719. (defrule
  720.     (goal secondary-build 1)
  721. =>
  722.     (generate-random-number 4)
  723. )
  724.  
  725. (defrule
  726.     (goal secondary-build 1)
  727.     (random-number == 1)
  728.     (can-train paladin)
  729.     (or
  730.         (population < deathmatch-unit-max)
  731.         (and
  732.             (population < unit-max)
  733.             (goal need-deathmatch-villagers NO)
  734.         )
  735.     )
  736. =>
  737.     (train paladin)
  738.     (set-goal secondary-build 0)
  739. )
  740.  
  741. (defrule
  742.     (goal secondary-build 1)
  743.     (random-number == 2)
  744.     (can-train hussar)
  745.     (not (can-afford-unit paladin) )
  746.     (or
  747.         (population < deathmatch-unit-max)
  748.         (and
  749.             (population < unit-max)
  750.             (goal need-deathmatch-villagers NO)
  751.         )
  752.     )
  753. =>
  754.     (train hussar)
  755.     (set-goal secondary-build 0)
  756. )
  757.  
  758. (defrule
  759.     (goal secondary-build 1)
  760.     (random-number == 3)
  761.     (can-train heavy-cavalry-archer)
  762.     (or
  763.         (population < deathmatch-unit-max)
  764.         (and
  765.             (population < unit-max)
  766.             (goal need-deathmatch-villagers NO)
  767.         )
  768.     )
  769. =>
  770.     (train heavy-cavalry-archer)
  771.     (set-goal secondary-build 0)
  772. )
  773.  
  774. (defrule
  775.     (goal secondary-build 1)
  776.     (random-number == 4)
  777.     (can-train heavy-scorpion)
  778.     (or
  779.         (population < deathmatch-unit-max)
  780.         (and
  781.             (population < unit-max)
  782.             (goal need-deathmatch-villagers NO)
  783.         )
  784.     )
  785. =>
  786.     (train heavy-scorpion)
  787.     (set-goal secondary-build 0)
  788. )
  789. #end-if
  790. ;****************************
  791. #load-if-defined GOTHIC-CIV
  792. ;train huskarls, lt cav, hvy HA, hvy scorps
  793. (defrule
  794.     (true)
  795. =>
  796.     (set-goal combat-arm INFANTRY)
  797.     (set-goal monk-rating POOR)
  798.     (set-goal 36 2)
  799.     (set-goal 37 NO)
  800.     (set-goal 38 YES)
  801.     (set-goal 39 NO)
  802.  
  803.     (set-strategic-number sn-wood-gatherer-percentage 20)
  804.     (set-strategic-number sn-food-gatherer-percentage 50)
  805.     (set-strategic-number sn-gold-gatherer-percentage 25)
  806.     (set-strategic-number sn-stone-gatherer-percentage 5)
  807.     (disable-self)
  808. )
  809.  
  810. (defrule
  811.     (goal secondary-build 1)
  812. =>
  813.     (generate-random-number 3)
  814. )
  815.  
  816. (defrule
  817.     (goal secondary-build 1)
  818.     (random-number == 1)
  819.     (can-train hussar)
  820.     (or
  821.         (population < deathmatch-unit-max)
  822.         (and
  823.             (population < unit-max)
  824.             (goal need-deathmatch-villagers NO)
  825.         )
  826.     )
  827. =>
  828.     (train hussar)
  829.     (set-goal secondary-build 0)
  830. )
  831.  
  832. (defrule
  833.     (goal secondary-build 1)
  834.     (random-number == 2)
  835.     (can-train heavy-cavalry-archer)
  836.     (or
  837.         (population < deathmatch-unit-max)
  838.         (and
  839.             (population < unit-max)
  840.             (goal need-deathmatch-villagers NO)
  841.         )
  842.     )
  843. =>
  844.     (train heavy-cavalry-archer)
  845.     (set-goal secondary-build 0)
  846. )
  847.  
  848. (defrule
  849.     (goal secondary-build 1)
  850.     (random-number == 3)
  851.     (can-train heavy-scorpion)
  852.     (or
  853.         (population < deathmatch-unit-max)
  854.         (and
  855.             (population < unit-max)
  856.             (goal need-deathmatch-villagers NO)
  857.         )
  858.     )
  859. =>
  860.     (train heavy-scorpion)
  861.     (set-goal secondary-build 0)
  862. )
  863. #end-if
  864. ;********************************
  865. #load-if-defined JAPANESE-CIV
  866. ;train samurai, hvy HA, arbalests, hand-cannoneer, hvy scorps
  867. (defrule
  868.     (true)
  869. =>
  870.     (set-goal combat-arm INFANTRY)
  871.     (set-goal monk-rating GOOD)
  872.     (set-goal 36 2)
  873.     (set-goal 37 NO)
  874.     (set-goal 38 YES)
  875.     (set-goal 39 YES)
  876.  
  877.     (set-strategic-number sn-wood-gatherer-percentage 20)
  878.     (set-strategic-number sn-food-gatherer-percentage 50)
  879.     (set-strategic-number sn-gold-gatherer-percentage 25)
  880.     (set-strategic-number sn-stone-gatherer-percentage 5)
  881.     (disable-self)
  882. )
  883.  
  884. (defrule
  885.     (goal secondary-build 1)
  886. =>
  887.     (generate-random-number 3)
  888. )
  889.  
  890. (defrule
  891.     (goal secondary-build 1)
  892.     (random-number == 1)
  893.     (can-train heavy-cavalry-archer)
  894.     (or
  895.         (population < deathmatch-unit-max)
  896.         (and
  897.             (population < unit-max)
  898.             (goal need-deathmatch-villagers NO)
  899.         )
  900.     )
  901. =>
  902.     (train heavy-cavalry-archer)
  903.     (set-goal secondary-build 0)
  904. )
  905.  
  906. (defrule
  907.     (goal secondary-build 1)
  908.     (random-number == 2)
  909.     (or
  910.         (can-train hand-cannoneer)
  911.         (can-train arbalest)
  912.     )
  913.     (or
  914.         (population < deathmatch-unit-max)
  915.         (and
  916.             (population < unit-max)
  917.             (goal need-deathmatch-villagers NO)
  918.         )
  919.     )
  920. =>
  921.     (train hand-cannoneer)
  922.     (train arbalest)
  923.     (set-goal secondary-build 0)
  924. )
  925.  
  926. (defrule
  927.     (goal secondary-build 1)
  928.     (random-number == 3)
  929.     (can-train heavy-scorpion)
  930.     (or
  931.         (population < deathmatch-unit-max)
  932.         (and
  933.             (population < unit-max)
  934.             (goal need-deathmatch-villagers NO)
  935.         )
  936.     )
  937. =>
  938.     (train heavy-scorpion)
  939.     (set-goal secondary-build 0)
  940. )
  941. #end-if
  942. ;*********************************
  943. #load-if-defined MONGOL-CIV
  944. ;trains mangudai, champs, light cav
  945. (defrule
  946.     (true)
  947. =>
  948.     (set-goal combat-arm CAVARCHER)
  949.     (set-goal monk-rating POOR)
  950.     (set-goal 36 YES)
  951.     (set-goal 37 NO)
  952.     (set-goal 38 2)
  953.     (set-goal 39 YES)
  954.  
  955.     (set-strategic-number sn-wood-gatherer-percentage 35)
  956.     (set-strategic-number sn-food-gatherer-percentage 25)
  957.     (set-strategic-number sn-gold-gatherer-percentage 35)
  958.     (set-strategic-number sn-stone-gatherer-percentage 5)
  959.     (disable-self)
  960. )
  961.  
  962. (defrule
  963.     (goal secondary-build 1)
  964. =>
  965.     (generate-random-number 2)
  966. )
  967.  
  968. (defrule
  969.     (goal secondary-build 1)
  970.     (random-number == 1)
  971.     (can-train champion)
  972.     (or
  973.         (population < deathmatch-unit-max)
  974.         (and
  975.             (population < unit-max)
  976.             (goal need-deathmatch-villagers NO)
  977.         )
  978.     )
  979. =>
  980.     (train champion)
  981.     (set-goal secondary-build 0)
  982. )
  983.  
  984. (defrule
  985.     (goal secondary-build 1)
  986.     (random-number == 2)
  987.     (can-train hussar)
  988.     (or
  989.         (population < deathmatch-unit-max)
  990.         (and
  991.             (population < unit-max)
  992.             (goal need-deathmatch-villagers NO)
  993.         )
  994.     )
  995. =>
  996.     (train hussar)
  997.     (set-goal secondary-build 0)
  998. )
  999. #end-if
  1000. ;***********************************
  1001. #load-if-defined PERSIAN-CIV
  1002. ;trains elephants, hvy HA
  1003. (defrule
  1004.     (true)
  1005. =>
  1006.     (set-goal combat-arm CAVALRY)
  1007.     (set-goal monk-rating POOR)
  1008.     (set-goal 36 NO)
  1009.     (set-goal 37 YES)
  1010.     (set-goal 38 YES)
  1011.     (set-goal 39 NO)
  1012.  
  1013.     (set-strategic-number sn-wood-gatherer-percentage 20)
  1014.     (set-strategic-number sn-food-gatherer-percentage 50)
  1015.     (set-strategic-number sn-gold-gatherer-percentage 25)
  1016.     (set-strategic-number sn-stone-gatherer-percentage 5)
  1017.     (disable-self)
  1018. )
  1019.  
  1020. (defrule
  1021.     (goal secondary-build 1)
  1022. =>
  1023.     (generate-random-number 2)
  1024. )
  1025.  
  1026. (defrule
  1027.     (goal secondary-build 1)
  1028.     (random-number == 1)
  1029.     (can-train heavy-cavalry-archer)
  1030.     (or
  1031.         (population < deathmatch-unit-max)
  1032.         (and
  1033.             (population < unit-max)
  1034.             (goal need-deathmatch-villagers NO)
  1035.         )
  1036.     )
  1037. =>
  1038.     (train heavy-cavalry-archer)
  1039.     (set-goal secondary-build 0)
  1040. )
  1041.  
  1042. (defrule
  1043.     (goal secondary-build 1)
  1044.     (random-number == 2)
  1045.     (can-train hussar)
  1046.     (nor
  1047.         (can-train elite-war-elephant)
  1048.         (can-train paladin)
  1049.     )
  1050.     (or
  1051.         (population < deathmatch-unit-max)
  1052.         (and
  1053.             (population < unit-max)
  1054.             (goal need-deathmatch-villagers NO)
  1055.         )
  1056.     )
  1057. =>
  1058.     (train hussar)
  1059.     (set-goal secondary-build 0)
  1060. )
  1061.  
  1062. #end-if
  1063. ;***********************************
  1064. #load-if-defined SARACEN-CIV
  1065. ;trains mamluks, hvy HA, arbalests, hand cannoneers
  1066. (defrule
  1067.     (true)
  1068. =>
  1069.     (set-goal combat-arm CAVALRY)
  1070.     (set-goal monk-rating GOOD)
  1071.     (set-goal 36 YES)
  1072.     (set-goal 37 NO)
  1073.     (set-goal 38 YES)
  1074.     (set-goal 39 YES)
  1075.  
  1076.     (set-strategic-number sn-wood-gatherer-percentage 20)
  1077.     (set-strategic-number sn-food-gatherer-percentage 45)
  1078.     (set-strategic-number sn-gold-gatherer-percentage 30)
  1079.     (set-strategic-number sn-stone-gatherer-percentage 5)
  1080.     (disable-self)
  1081. )
  1082.  
  1083. (defrule
  1084.     (goal secondary-build 1)
  1085. =>
  1086.     (generate-random-number 3)
  1087. )
  1088.  
  1089. (defrule
  1090.     (goal secondary-build 1)
  1091.     (random-number == 1)
  1092.     (can-train heavy-cavalry-archer)
  1093.     (or
  1094.         (population < deathmatch-unit-max)
  1095.         (and
  1096.             (population < unit-max)
  1097.             (goal need-deathmatch-villagers NO)
  1098.         )
  1099.     )
  1100. =>
  1101.     (train heavy-cavalry-archer)
  1102.     (set-goal secondary-build 0)
  1103. )
  1104.  
  1105. (defrule
  1106.     (goal secondary-build 1)
  1107.     (random-number == 2)
  1108.     (or
  1109.         (can-train hand-cannoneer)
  1110.         (can-train arbalest)
  1111.     )
  1112.     (or
  1113.         (population < deathmatch-unit-max)
  1114.         (and
  1115.             (population < unit-max)
  1116.             (goal need-deathmatch-villagers NO)
  1117.         )
  1118.     )
  1119. =>
  1120.     (train hand-cannoneer)
  1121.     (train arbalest)
  1122.     (set-goal secondary-build 0)
  1123. )
  1124.  
  1125. (defrule
  1126.     (goal secondary-build 1)
  1127.     (random-number == 3)
  1128.     (can-train hussar)
  1129.     (not (can-train elite-mameluke) )
  1130.     (or
  1131.         (population < deathmatch-unit-max)
  1132.         (and
  1133.             (population < unit-max)
  1134.             (goal need-deathmatch-villagers NO)
  1135.         )
  1136.     )
  1137. =>
  1138.     (train hussar)
  1139.     (set-goal secondary-build 0)
  1140. )
  1141. #end-if
  1142. ;*********************************
  1143. #load-if-defined TEUTONIC-CIV
  1144. ;trains TK, paladins, hvy scorps
  1145. (defrule
  1146.     (true)
  1147. =>
  1148.     (set-goal combat-arm INFANTRY)
  1149.     (set-goal monk-rating GOOD)
  1150.     (set-goal 36 2)
  1151.     (set-goal 37 YES)
  1152.     (set-goal 38 NO)
  1153.     (set-goal 39 NO)
  1154.  
  1155.     (set-strategic-number sn-wood-gatherer-percentage 20)
  1156.     (set-strategic-number sn-food-gatherer-percentage 50)
  1157.     (set-strategic-number sn-gold-gatherer-percentage 25)
  1158.     (set-strategic-number sn-stone-gatherer-percentage 5)
  1159.     (disable-self)
  1160. )
  1161.  
  1162. (defrule
  1163.     (goal secondary-build 1)
  1164. =>
  1165.     (generate-random-number 2)
  1166. )
  1167.  
  1168. (defrule
  1169.     (goal secondary-build 1)
  1170.     (random-number == 1)
  1171.     (can-train paladin)
  1172.     (or
  1173.         (population < deathmatch-unit-max)
  1174.         (and
  1175.             (population < unit-max)
  1176.             (goal need-deathmatch-villagers NO)
  1177.         )
  1178.     )
  1179. =>
  1180.     (train paladin)
  1181.     (set-goal secondary-build 0)
  1182. )
  1183.  
  1184. (defrule
  1185.     (goal secondary-build 1)
  1186.     (random-number == 2)
  1187.     (can-train heavy-scorpion)
  1188.     (or
  1189.         (population < deathmatch-unit-max)
  1190.         (and
  1191.             (population < unit-max)
  1192.             (goal need-deathmatch-villagers NO)
  1193.         )
  1194.     )
  1195. =>
  1196.     (train heavy-scorpion)
  1197.     (set-goal secondary-build 0)
  1198. )
  1199. #end-if
  1200. ;************************************
  1201. #load-if-defined TURKISH-CIV
  1202. ;trains janissaries, champs, lt cav, hvy scorp
  1203. (defrule
  1204.     (true)
  1205. =>
  1206.     (set-goal combat-arm ARCHER)
  1207.     (set-goal monk-rating FAIR)
  1208.     (set-goal 36 YES)
  1209.     (set-goal 37 NO)
  1210.     (set-goal 38 YES)
  1211.     (set-goal 39 NO)
  1212.  
  1213.     (set-strategic-number sn-wood-gatherer-percentage 25)
  1214.     (set-strategic-number sn-food-gatherer-percentage 35)
  1215.     (set-strategic-number sn-gold-gatherer-percentage 35)
  1216.     (set-strategic-number sn-stone-gatherer-percentage 5)
  1217.     (disable-self)
  1218. )
  1219.  
  1220. (defrule
  1221.     (goal secondary-build 1)
  1222. =>
  1223.     (generate-random-number 3)
  1224. )
  1225.  
  1226. (defrule
  1227.     (goal secondary-build 1)
  1228.     (random-number == 1)
  1229.     (can-train champion)
  1230.     (or
  1231.         (population < deathmatch-unit-max)
  1232.         (and
  1233.             (population < unit-max)
  1234.             (goal need-deathmatch-villagers NO)
  1235.         )
  1236.     )
  1237. =>
  1238.     (train champion)
  1239.     (set-goal secondary-build 0)
  1240. )
  1241.  
  1242. (defrule
  1243.     (goal secondary-build 1)
  1244.     (random-number == 2)
  1245.     (can-train hussar)
  1246.     (or
  1247.         (population < deathmatch-unit-max)
  1248.         (and
  1249.             (population < unit-max)
  1250.             (goal need-deathmatch-villagers NO)
  1251.         )
  1252.     )
  1253. =>
  1254.     (train hussar)
  1255.     (set-goal secondary-build 0)
  1256. )
  1257.  
  1258. (defrule
  1259.     (goal secondary-build 1)
  1260.     (random-number == 3)
  1261.     (can-train heavy-scorpion)
  1262.     (or
  1263.         (population < deathmatch-unit-max)
  1264.         (and
  1265.             (population < unit-max)
  1266.             (goal need-deathmatch-villagers NO)
  1267.         )
  1268.     )
  1269. =>
  1270.     (train heavy-scorpion)
  1271.     (set-goal secondary-build 0)
  1272. )
  1273. #end-if
  1274. ;********************************
  1275. #load-if-defined VIKING-CIV
  1276. ;trains berserks, lt cav, arbalests, hvy scorp
  1277. (defrule
  1278.     (true)
  1279. =>
  1280.     (set-goal combat-arm INFANTRY)
  1281.     (set-goal monk-rating POOR)
  1282.     (set-goal 36 2)
  1283.     (set-goal 37 NO)
  1284.     (set-goal 38 NO)
  1285.     (set-goal 39 YES)
  1286.  
  1287.     (set-strategic-number sn-wood-gatherer-percentage 20)
  1288.     (set-strategic-number sn-food-gatherer-percentage 50)
  1289.     (set-strategic-number sn-gold-gatherer-percentage 25)
  1290.     (set-strategic-number sn-stone-gatherer-percentage 5)
  1291.     (disable-self)
  1292. )
  1293.  
  1294. (defrule
  1295.     (goal secondary-build 1)
  1296. =>
  1297.     (generate-random-number 3)
  1298. )
  1299.  
  1300. (defrule
  1301.     (goal secondary-build 1)
  1302.     (random-number == 1)
  1303.     (can-train light-cavalry)
  1304.     (or
  1305.         (population < deathmatch-unit-max)
  1306.         (and
  1307.             (population < unit-max)
  1308.             (goal need-deathmatch-villagers NO)
  1309.         )
  1310.     )
  1311. =>
  1312.     (train light-cavalry)
  1313.     (set-goal secondary-build 0)
  1314. )
  1315.  
  1316. (defrule
  1317.     (goal secondary-build 1)
  1318.     (random-number == 2)
  1319.     (can-train arbalest)
  1320.     (or
  1321.         (population < deathmatch-unit-max)
  1322.         (and
  1323.             (population < unit-max)
  1324.             (goal need-deathmatch-villagers NO)
  1325.         )
  1326.     )
  1327. =>
  1328.     (train arbalest)
  1329.     (set-goal secondary-build 0)
  1330. )
  1331.  
  1332. (defrule
  1333.     (goal secondary-build 1)
  1334.     (random-number == 3)
  1335.     (can-train heavy-scorpion)
  1336.     (or
  1337.         (population < deathmatch-unit-max)
  1338.         (and
  1339.             (population < unit-max)
  1340.             (goal need-deathmatch-villagers NO)
  1341.         )
  1342.     )
  1343. =>
  1344.     (train heavy-scorpion)
  1345.     (set-goal secondary-build 0)
  1346. )
  1347. #end-if
  1348. ;*********************************************************
  1349. ;*********************************************************
  1350. #load-if-defined DIFFICULTY-EASIEST
  1351. (defrule
  1352.     (true)
  1353. =>
  1354.     (set-strategic-number sn-percent-enemy-sighted-response 10)
  1355.     (set-strategic-number sn-consecutive-idle-unit-limit 60)
  1356.     (set-strategic-number sn-easiest-reaction-percentage 20)
  1357.     (set-difficulty-parameter ability-to-maintain-distance 100)
  1358.     (set-difficulty-parameter ability-to-dodge-missiles 100)
  1359.     (disable-self)
  1360. )
  1361. #end-if
  1362. ;********************************
  1363. #load-if-defined DIFFICULTY-EASY
  1364. (load "petersen tower")
  1365.  
  1366. (defrule
  1367.     (true)
  1368. =>
  1369.     (set-strategic-number sn-percent-enemy-sighted-response 25)
  1370.     (set-strategic-number sn-consecutive-idle-unit-limit 20)
  1371.     (set-strategic-number sn-easier-reaction-percentage 20)
  1372.     (set-strategic-number sn-hits-before-alliance-change 50)
  1373.     (set-difficulty-parameter ability-to-maintain-distance 75)
  1374.     (set-difficulty-parameter ability-to-dodge-missiles 75)
  1375.     (disable-self)
  1376. )
  1377. #end-if
  1378.  
  1379. ;********************************
  1380. #load-if-defined DIFFICULTY-MODERATE
  1381. (load "petersen tower")
  1382. (load "petersen wonder")
  1383.  
  1384. (defrule
  1385.     (true)
  1386. =>
  1387.     (set-strategic-number sn-percent-enemy-sighted-response 75)
  1388.     (set-strategic-number sn-consecutive-idle-unit-limit 5)
  1389.     (set-strategic-number sn-hits-before-alliance-change 25)
  1390.     (set-difficulty-parameter ability-to-maintain-distance 50)
  1391.     (set-difficulty-parameter ability-to-dodge-missiles 50)
  1392.     (disable-self)
  1393. )
  1394. #end-if
  1395.  
  1396. ;********************************
  1397. #load-if-defined DIFFICULTY-HARD
  1398. (load "petersen tower")
  1399. (load "petersen wonder")
  1400.  
  1401. (defrule
  1402.     (true)
  1403. =>
  1404.     (set-strategic-number sn-percent-enemy-sighted-response 99)
  1405.     (set-strategic-number sn-consecutive-idle-unit-limit 1)
  1406.     (set-strategic-number sn-hits-before-alliance-change 10)
  1407.     (set-difficulty-parameter ability-to-maintain-distance 0)
  1408.     (set-difficulty-parameter ability-to-dodge-missiles 0)
  1409.     (disable-self)
  1410. )
  1411. #end-if
  1412.  
  1413. ;********************************
  1414. #load-if-defined DIFFICULTY-HARDEST
  1415. (load "petersen tower")
  1416. (load "petersen wonder")
  1417.  
  1418. (defrule
  1419.     (true)
  1420. =>
  1421.     (set-strategic-number sn-percent-enemy-sighted-response 99)
  1422.     (set-strategic-number sn-hits-before-alliance-change 10)
  1423.     (set-difficulty-parameter ability-to-maintain-distance 0)
  1424.     (set-difficulty-parameter ability-to-dodge-missiles 0)
  1425.     (disable-self)
  1426. )
  1427. #end-if
  1428. ;********************************
  1429. ;********************************
  1430.  
  1431. (defrule
  1432.     (cc-players-building-type-count any-enemy castle == 0)
  1433. =>
  1434.     (set-goal rush-control RUSHING)
  1435. )
  1436.  
  1437. (defrule
  1438.     (goal rush-control RUSHING)
  1439.     (cc-players-building-type-count every-enemy castle > 0)
  1440. =>
  1441.     (set-goal rush-control NO)
  1442. )
  1443.  
  1444. ;========================DARK AGE RULES
  1445. (defrule
  1446.     (true)
  1447. =>
  1448.     (set-strategic-number sn-coop-share-information 1)
  1449.     (set-strategic-number sn-coop-share-attacking 1)
  1450.     (set-strategic-number sn-maximum-town-size imperial-town-size)
  1451.  
  1452.     (set-strategic-number sn-task-ungrouped-soldiers 0)
  1453.     (set-strategic-number sn-zero-priority-distance 250)
  1454.     (set-strategic-number sn-blot-exploration-map 0)
  1455.  
  1456.     (set-strategic-number sn-attack-intelligence 1)
  1457.     (set-strategic-number sn-gather-defense-units 1)
  1458.     (set-strategic-number sn-defense-distance 2)
  1459.  
  1460.     (set-strategic-number sn-maximum-gaia-attack-response 1)
  1461.     (set-strategic-number sn-ignore-attack-group-under-attack 1)
  1462.     (set-strategic-number sn-allow-civilian-defense 0)
  1463.  
  1464.     (disable-self)
  1465. )
  1466.  
  1467. (defrule
  1468.     (true)
  1469. =>
  1470.     (set-strategic-number sn-stone-dropsite-distance 3)
  1471.     (set-strategic-number sn-gold-dropsite-distance 3)
  1472.     (set-strategic-number sn-retask-gather-amount 20)
  1473.     (set-strategic-number sn-camp-max-distance 15)
  1474.  
  1475.     (set-strategic-number sn-mill-max-distance 15)
  1476.     (set-strategic-number sn-enemy-sighted-response-distance 15)
  1477.     (set-strategic-number sn-group-form-distance 10)
  1478.  
  1479.     (set-strategic-number sn-town-defend-priority 7)
  1480.     (set-strategic-number sn-gold-defend-priority 2)
  1481.     (set-strategic-number sn-stone-defend-priority 3)
  1482.     (set-strategic-number sn-forage-defend-priority 0)
  1483.  
  1484.     (disable-self)
  1485. )
  1486.  
  1487. (defrule
  1488.     (true)
  1489. =>
  1490.     (set-strategic-number sn-relic-defend-priority 0)
  1491.     (set-strategic-number sn-cap-civilian-gatherers 100)
  1492.     (set-strategic-number sn-percent-civilian-gatherers 0)
  1493.  
  1494.     (set-strategic-number sn-minimum-civilian-explorers 0)
  1495.     (set-strategic-number sn-cap-civilian-explorers 0)
  1496.     (set-strategic-number sn-percent-civilian-explorers 0)
  1497.  
  1498.     (set-strategic-number sn-cap-civilian-builders 12)
  1499.     (set-strategic-number sn-percent-civilian-builders 100)
  1500.  
  1501.     (disable-self)
  1502. )
  1503.  
  1504. (defrule
  1505.     (game-time > 600)
  1506. =>
  1507.     (set-strategic-number sn-blot-exploration-map 1)
  1508.     (disable-self)
  1509. )
  1510.  
  1511. (defrule
  1512.     (building-type-count siege-workshop >= 3)
  1513.     (building-type-count castle >= 3)
  1514.     (or
  1515.         (or
  1516.             (wood-amount < 5000)
  1517.             (food-amount < 5000)
  1518.         )
  1519.         (or
  1520.             (gold-amount < 2000)
  1521.             (stone-amount < 700)
  1522.         )
  1523.     )
  1524. =>
  1525.     (set-strategic-number sn-percent-civilian-builders 15)
  1526.     (set-strategic-number sn-percent-civilian-gatherers 85)
  1527.     (enable-timer t-lumbercamp 1)
  1528.     (disable-self)
  1529. )
  1530.  
  1531. (defrule
  1532.     (strategic-number sn-percent-civilian-gatherers == 85)
  1533.     (or
  1534.         (or
  1535.             (wood-amount < 500)
  1536.             (food-amount < 500)
  1537.         )
  1538.         (or
  1539.             (gold-amount < 500)
  1540.             (stone-amount < 100)
  1541.         )
  1542.     )
  1543. =>
  1544.     (set-strategic-number sn-percent-civilian-builders 10)
  1545.     (set-strategic-number sn-percent-civilian-gatherers 90)
  1546.     (disable-self)
  1547. )
  1548.  
  1549. ; villager count
  1550. (defrule
  1551.     (can-train villager)
  1552.     (or
  1553.         (or
  1554.             (civilian-population < 6)
  1555.             (and
  1556.                 (current-age == feudal-age)
  1557.                 (civilian-population < 8)
  1558.             )
  1559.         )
  1560.         (or
  1561.             (and
  1562.                 (current-age == castle-age)
  1563.                 (civilian-population < 10)
  1564.             )
  1565.             (and
  1566.                 (current-age == imperial-age)
  1567.                 (civilian-population < civ-dark-rush)
  1568.             )
  1569.         )
  1570.     )
  1571. =>
  1572.     (train villager)
  1573. )
  1574.  
  1575. (defrule
  1576.     (strategic-number sn-percent-civilian-gatherers == 90)
  1577.     (civilian-population < civ-castle)
  1578.     (can-train villager)
  1579. =>
  1580.     (train villager)
  1581. )
  1582.  
  1583. (defrule
  1584.     (building-type-count-total lumber-camp > 0)
  1585.     (idle-farm-count == 0)
  1586.     (sheep-and-forage-too-far)
  1587.     (can-build farm)
  1588. =>
  1589.     (build farm)
  1590. )
  1591.  
  1592. ;*********************************
  1593. ;age advancement
  1594. (defrule
  1595.     (can-research feudal-age)
  1596.     (or
  1597.         (players-current-age every-human >= feudal-age)
  1598.         (difficulty <= moderate)
  1599.     )
  1600. =>
  1601.     (research feudal-age)
  1602.     (set-goal age-advancement NOTICE)
  1603.     (enable-timer t-ageup 140)
  1604. )
  1605.  
  1606. (defrule
  1607.     (current-age == feudal-age)
  1608. =>
  1609.     (disable-timer t-ageup)
  1610.     (set-goal age-advancement NO)
  1611.     (disable-self)
  1612. )
  1613.  
  1614. (defrule
  1615.     (can-research castle-age)
  1616.     (or
  1617.         (players-current-age every-human >= castle-age)
  1618.         (difficulty <= moderate)
  1619.     )
  1620. =>
  1621.     (research castle-age)
  1622.     (set-goal age-advancement NOTICE)
  1623.     (enable-timer t-ageup 170)
  1624. )
  1625.  
  1626. (defrule
  1627.     (current-age == castle-age)
  1628. =>
  1629.     (disable-timer t-ageup)
  1630.     (set-goal age-advancement NO)
  1631.     (disable-self)
  1632. )
  1633.  
  1634. (defrule
  1635.     (can-research imperial-age)
  1636.     (or
  1637.         (difficulty <= moderate)
  1638.         (and
  1639.             (players-current-age every-human == imperial-age)
  1640.             (difficulty == easy)
  1641.         )
  1642.     )
  1643. =>
  1644.     (research imperial-age)
  1645.     (set-goal age-advancement NOTICE)
  1646.     (enable-timer t-ageup 200)
  1647. )
  1648.  
  1649. (defrule
  1650.     (difficulty <= moderate)
  1651.     (current-age == imperial-age)
  1652. =>
  1653.     (disable-timer t-ageup)
  1654.     (set-goal age-advancement NO)
  1655.     (disable-self)
  1656. )
  1657.  
  1658. (defrule
  1659.     (goal age-advancement NOTICE)
  1660.     (or
  1661.         (current-age < imperial-age)
  1662.         (and
  1663.             (current-age < imperial-age)
  1664.             (difficulty <= easy)
  1665.         )
  1666.     )
  1667.     (timer-triggered t-ageup)
  1668. =>
  1669.     (disable-timer t-ageup)
  1670.     (set-goal age-advancement NO)
  1671. )
  1672. ;*********************************
  1673. ;buildings
  1674. (defrule
  1675.     (difficulty <= moderate)
  1676.     (building-type-count-total house <= fifteen-percent-pop)
  1677.     (can-build house)
  1678. =>
  1679.     (build house)
  1680. )
  1681.  
  1682. #load-if-defined DIFFICULTY-EASIEST
  1683. (defrule
  1684.     (military-population < 10)
  1685.     (housing-headroom < 5)
  1686.     (population-headroom > 0)
  1687.     (can-build house)
  1688. =>
  1689.     (build house)
  1690. )
  1691. #end-if
  1692.  
  1693. #load-if-defined DIFFICULTY-EASY
  1694. (defrule
  1695.     (military-population < civ-dark-rush)
  1696.     (housing-headroom < 5)
  1697.     (population-headroom > 0)
  1698.     (can-build house)
  1699. =>
  1700.     (build house)
  1701. )
  1702. #end-if
  1703.  
  1704. (defrule
  1705.     (strategic-number sn-gold-gatherer-percentage > 0)
  1706.     (building-type-count mining-camp == 0)
  1707.     (resource-found gold)
  1708.     (can-build mining-camp)
  1709. =>
  1710.     (build mining-camp)
  1711. )
  1712.  
  1713. (defrule
  1714.     (strategic-number sn-wood-gatherer-percentage > 0)
  1715.     (building-type-count lumber-camp == 0)
  1716.     (can-build lumber-camp)
  1717. =>
  1718.     (build lumber-camp)
  1719. )
  1720.  
  1721. (defrule
  1722.     (current-age == imperial-age)
  1723.     (building-type-count siege-workshop > 0)
  1724.     (building-type-count castle > 0)
  1725.     (building-type-count town-center < 3)
  1726.     (can-build town-center)
  1727. =>
  1728.     (build town-center)
  1729. )
  1730.  
  1731. ;build the following after running low on resources
  1732.  
  1733. (defrule
  1734.     (strategic-number sn-percent-civilian-gatherers >= 85)
  1735.     (timer-triggered t-lumbercamp)
  1736.     (resource-found gold)
  1737.     (resource-found stone)
  1738.     (or
  1739.         (dropsite-min-distance gold > 7)
  1740.         (dropsite-min-distance stone > 7)
  1741.     )
  1742.     (can-build town-center)
  1743. =>
  1744.     (build town-center)
  1745. )
  1746.  
  1747. (defrule
  1748.     (strategic-number sn-percent-civilian-gatherers >= 85)
  1749.     (timer-triggered t-lumbercamp)
  1750.     (resource-found wood)
  1751.     (dropsite-min-distance wood > 7)
  1752.     (can-build town-center)
  1753. =>
  1754.     (build town-center)
  1755. )
  1756.  
  1757. (defrule
  1758.     (timer-triggered t-lumbercamp)
  1759. =>
  1760.     (disable-timer t-lumbercamp)
  1761.     (enable-timer t-lumbercamp 60)
  1762. )
  1763.  
  1764. (defrule
  1765.     (building-type-count-total mill == 0)
  1766.     (building-type-count-total market == 0)
  1767.     (can-build mill)
  1768. =>
  1769.     (build mill)
  1770. )
  1771.  
  1772. (defrule
  1773.     (building-type-count-total market == 0)
  1774.     (can-build market)
  1775. =>
  1776.     (build market)
  1777. )
  1778.  
  1779. (defrule
  1780.     (building-type-count-total monastery < 3)
  1781.     (can-build monastery)
  1782. =>
  1783.     (build monastery)
  1784. )
  1785.  
  1786. (defrule
  1787.     (can-build barracks)
  1788.     (building-type-count-total barracks < 2)
  1789. =>
  1790.     (build barracks)
  1791. )
  1792.  
  1793. (defrule
  1794.     (building-type-count-total barracks == 2)
  1795.     (unit-type-count villager > 6)
  1796.     (can-build barracks)
  1797. =>
  1798.     (build-forward barracks)
  1799. )
  1800.  
  1801. (defrule
  1802.     (building-type-count-total archery-range < 2)
  1803.     (can-build archery-range)
  1804. =>
  1805.     (build archery-range)
  1806. )
  1807.  
  1808. (defrule
  1809.     (building-type-count-total archery-range == 2)
  1810.     (unit-type-count villager > 6)
  1811.     (can-build archery-range)
  1812. =>
  1813.     (build-forward archery-range)
  1814. )
  1815.  
  1816. (defrule
  1817.     (building-type-count-total stable < 2)
  1818.     (can-build stable)
  1819. =>
  1820.     (build stable)
  1821. )
  1822.  
  1823. (defrule
  1824.     (building-type-count-total stable == 2)
  1825.     (unit-type-count villager > 6)
  1826.     (can-build stable)
  1827. =>
  1828.     (build-forward stable)
  1829. )
  1830.  
  1831. (defrule
  1832.     (building-type-count-total siege-workshop < 2)
  1833.     (can-build siege-workshop)
  1834. =>
  1835.     (build siege-workshop)
  1836. )
  1837.  
  1838. (defrule
  1839.     (building-type-count-total siege-workshop > 1)
  1840.     (building-type-count-total siege-workshop < 4)
  1841.     (unit-type-count villager > 6)
  1842.     (can-build siege-workshop)
  1843. =>
  1844.     (build-forward siege-workshop)
  1845. )
  1846.  
  1847. (defrule
  1848.     (building-type-count-total castle < 3)
  1849.     (can-build castle)
  1850. =>
  1851.     (build castle)
  1852. )
  1853.  
  1854. (defrule
  1855.     (building-type-count-total castle > 2)
  1856.     (building-type-count-total castle < 5)
  1857.     (unit-type-count villager > 6)
  1858.     (can-build castle)
  1859. =>
  1860.     (build-forward castle)
  1861. )
  1862.  
  1863. (defrule
  1864.     (or
  1865.         (and
  1866.             (goal 1 1)
  1867.             (building-type-count-total dock < 2)
  1868.         )
  1869.         (and
  1870.             (goal 1 10)
  1871.             (building-type-count-total dock < 4)
  1872.         )
  1873.     )
  1874.     (can-build dock)
  1875. =>
  1876.     (build dock)
  1877. )
  1878.  
  1879. (defrule
  1880.     (building-type-count-total blacksmith < 2)
  1881.     (can-build blacksmith)
  1882. =>
  1883.     (build blacksmith)
  1884. )
  1885.  
  1886. (defrule
  1887.     (building-type-count-total university == 0)
  1888.     (can-build university)
  1889. =>
  1890.     (build university)
  1891. )
  1892. ;*****************************************
  1893. ;UPGRADES
  1894. (defrule
  1895.     (can-research my-unique-unit-upgrade)
  1896. =>
  1897.     (research my-unique-unit-upgrade)
  1898. )
  1899.  
  1900. ;(defrule
  1901. ;    (can-research my-unique-research)
  1902. ;=>
  1903. ;    (research my-unique-research)
  1904. ;)
  1905.  
  1906. ;DOCK
  1907. (defrule
  1908.     (not (goal 1 0) )
  1909.     (can-research ri-war-galley)
  1910. =>
  1911.     (research ri-war-galley)
  1912. )
  1913.  
  1914. (defrule
  1915.     (not (goal 1 0) )
  1916.     (can-research ri-galleon)
  1917. =>
  1918.     (research ri-galleon)
  1919. )
  1920.  
  1921. (defrule
  1922.     (not (goal 1 0) )
  1923.     (can-research ri-fast-fire-ship)
  1924. =>
  1925.     (research ri-fast-fire-ship)
  1926. )
  1927.  
  1928. (defrule
  1929.     (not (goal 1 0) )
  1930.     (goal military-parity NO)
  1931.     (can-research ri-heavy-demolition-ship)
  1932. =>
  1933.     (research ri-heavy-demolition-ship)
  1934. )
  1935.  
  1936. (defrule
  1937.     (not (goal 1 0) )
  1938.     (can-research ri-cannon-galleon)
  1939. =>
  1940.     (research ri-cannon-galleon)
  1941. )
  1942.  
  1943. (defrule
  1944.     (not (goal 1 0) )
  1945.     (can-research ri-deck-guns)
  1946. =>
  1947.     (research ri-deck-guns)
  1948. )
  1949.  
  1950. ;BARRACKS UPGRADES
  1951. (defrule
  1952.     (or
  1953.         (goal 36 YES)
  1954.         (and
  1955.             (building-type-count castle == 0)
  1956.             (goal 36 2)
  1957.         )
  1958.     )
  1959.     (can-research ri-man-at-arms)
  1960. =>
  1961.     (research ri-man-at-arms)
  1962. )
  1963.  
  1964. (defrule
  1965.     (or
  1966.         (goal 36 YES)
  1967.         (and
  1968.             (building-type-count castle == 0)
  1969.             (goal 36 2)
  1970.         )
  1971.     )
  1972.     (can-research ri-long-swordsman)
  1973. =>
  1974.     (research ri-long-swordsman)
  1975. )
  1976.  
  1977. (defrule
  1978.     (or
  1979.         (goal 36 YES)
  1980.         (and
  1981.             (building-type-count castle == 0)
  1982.             (goal 36 2)
  1983.         )
  1984.     )
  1985.     (can-research ri-two-handed-swordsman)
  1986. =>
  1987.     (research ri-two-handed-swordsman)
  1988. )
  1989.  
  1990. (defrule
  1991.     (or
  1992.         (goal 36 YES)
  1993.         (and
  1994.             (building-type-count castle == 0)
  1995.             (goal 36 2)
  1996.         )
  1997.     )
  1998.     (can-research ri-champion)
  1999. =>
  2000.     (research ri-champion)
  2001. )
  2002.  
  2003. (defrule
  2004.     (unit-type-count spearman > 0)
  2005.     (can-research ri-pikeman)
  2006. =>
  2007.     (research ri-pikeman)
  2008. )
  2009.  
  2010. (defrule
  2011.     (unit-type-count pikeman > 0)
  2012.     (can-research ri-halberdier)
  2013. =>
  2014.     (research ri-halberdier)
  2015. )
  2016.  
  2017. (defrule
  2018.     (can-research ri-elite-eagle-warrior)
  2019. =>
  2020.     (research ri-elite-eagle-warrior)
  2021. )
  2022.  
  2023. (defrule
  2024.     (can-research ri-tracking)
  2025.     (not (goal 36 NO) )
  2026. =>
  2027.     (research ri-tracking)
  2028. )
  2029.  
  2030. (defrule
  2031.     (can-research ri-squires)
  2032.     (not (goal 36 NO) )
  2033. =>
  2034.     (research ri-squires)
  2035. )
  2036.  
  2037. ;STABLE
  2038. (defrule
  2039.     (or
  2040.         (goal 37 YES)
  2041.         (and
  2042.             (building-type-count castle == 0)
  2043.             (goal 37 2)
  2044.         )
  2045.     )
  2046.     (can-research ri-cavalier)
  2047. =>
  2048.     (research ri-cavalier)
  2049. )
  2050.  
  2051. (defrule
  2052.     (or
  2053.         (goal 37 YES)
  2054.         (and
  2055.             (building-type-count castle == 0)
  2056.             (goal 37 2)
  2057.         )
  2058.     )
  2059.     (can-research ri-paladin)
  2060. =>
  2061.     (research ri-paladin)
  2062. )
  2063.  
  2064. (defrule
  2065.     (can-research ri-light-cavalry)
  2066. =>
  2067.     (research ri-light-cavalry)
  2068. )
  2069.  
  2070. (defrule
  2071.     (can-research ri-hussar)
  2072. =>
  2073.     (research ri-hussar)
  2074. )
  2075.  
  2076. (defrule
  2077.     (unit-type-count camel > 0)
  2078.     (can-research ri-heavy-camel)
  2079. =>
  2080.     (research ri-heavy-camel)
  2081. )
  2082.  
  2083. (defrule
  2084.     (can-research ri-husbandry)
  2085.     (not (goal 37 NO) )
  2086. =>
  2087.     (research ri-husbandry)
  2088. )
  2089.  
  2090. (defrule
  2091.     (can-research ri-bloodlines)
  2092.     (nand
  2093.         (goal 37 NO)
  2094.         (goal 38 NO)
  2095.     )
  2096. =>
  2097.     (research ri-bloodlines)
  2098. )
  2099.  
  2100. ;ARCHERY RANGE
  2101. (defrule
  2102.     (or
  2103.         (goal 38 YES)
  2104.         (and
  2105.             (building-type-count castle == 0)
  2106.             (goal 38 2)
  2107.         )
  2108.     )
  2109.     (can-research ri-heavy-cavalry-archer)
  2110. =>
  2111.     (research ri-heavy-cavalry-archer)
  2112. )
  2113.  
  2114. (defrule
  2115.     (or
  2116.         (goal 39 YES)
  2117.         (and
  2118.             (building-type-count castle == 0)
  2119.             (goal 39 2)
  2120.         )
  2121.     )
  2122.     (can-research ri-crossbow)
  2123. =>
  2124.     (research ri-crossbow)
  2125. )
  2126.  
  2127. (defrule
  2128.     (or
  2129.         (goal 39 YES)
  2130.         (and
  2131.             (building-type-count castle == 0)
  2132.             (goal 39 2)
  2133.         )
  2134.     )
  2135.     (can-research ri-arbalest)
  2136. =>
  2137.     (research ri-arbalest)
  2138. )
  2139.  
  2140. (defrule
  2141.     (or
  2142.         (goal 39 YES)
  2143.         (and
  2144.             (building-type-count castle == 0)
  2145.             (goal 39 2)
  2146.         )
  2147.     )
  2148.     (can-research ri-hand-cannon)
  2149. =>
  2150.     (research ri-hand-cannon)
  2151. )
  2152.  
  2153. (defrule
  2154.     (unit-type-count skirmisher > 0)
  2155.     (can-research ri-elite-skirmisher)
  2156. =>
  2157.     (research ri-elite-skirmisher)
  2158. )
  2159.  
  2160. (defrule
  2161.     (nand
  2162.         (goal 38 NO)
  2163.         (goal 39 NO)
  2164.     )
  2165.     (can-research ri-thumb-ring)
  2166. =>
  2167.     (research ri-thumb-ring)
  2168. )
  2169.  
  2170. (defrule
  2171.     (not (goal 38 NO) )
  2172.     (can-research ri-parthian-tactics)
  2173. =>
  2174.     (research ri-parthian-tactics)
  2175. )
  2176.  
  2177. ;SIEGE EQUIPMENT
  2178. (defrule
  2179.     (or
  2180.         (goal combat-arm INFANTRY)
  2181.         (goal combat-arm ARCHER)
  2182.     )
  2183.     (can-research ri-heavy-scorpion)
  2184. =>
  2185.     (research ri-heavy-scorpion)
  2186. )
  2187.  
  2188. (defrule
  2189.     (can-research ri-capped-ram)
  2190.     (or
  2191.         (or
  2192.             (cc-players-building-type-count any-enemy town-center > 2)
  2193.             (cc-players-building-type-count any-enemy keep > 1)
  2194.         )
  2195.         (or
  2196.             (cc-players-building-type-count any-enemy bombard-tower > 0)
  2197.             (cc-players-building-type-count any-enemy castle > 0)
  2198.         )
  2199.     )
  2200. =>
  2201.     (research ri-capped-ram)
  2202. )
  2203.  
  2204. (defrule
  2205.     (or
  2206.         (or
  2207.             (cc-players-building-type-count any-enemy town-center > 2)
  2208.             (cc-players-building-type-count any-enemy keep > 3)
  2209.         )
  2210.         (or
  2211.             (cc-players-building-type-count any-enemy bombard-tower > 1)
  2212.             (cc-players-building-type-count any-enemy castle > 2)
  2213.         )
  2214.     )
  2215.     (can-research ri-siege-ram)
  2216. =>
  2217.     (research ri-siege-ram)
  2218. )
  2219.  
  2220. (defrule
  2221.     (can-research ri-onager)
  2222. =>
  2223.     (research ri-onager)
  2224. )
  2225.  
  2226. (defrule
  2227.     (can-research ri-siege-onager)
  2228. =>
  2229.     (research ri-siege-onager)
  2230. )
  2231.  
  2232. (defrule
  2233.     (can-research ri-bombard-cannon)
  2234. =>
  2235.     (research ri-bombard-cannon)
  2236. )
  2237. ;*********************************************************
  2238. ;UNIT PRODUCTION
  2239.  
  2240. (defrule
  2241.     (or
  2242.         (or
  2243.             (wood-amount < 5000)
  2244.             (food-amount < 5000)
  2245.         )
  2246.         (or
  2247.             (gold-amount < 2000)
  2248.             (stone-amount < 700)
  2249.         )
  2250.     )
  2251. =>
  2252.     (set-goal need-deathmatch-villagers YES)
  2253.     (disable-self)
  2254. )
  2255.  
  2256. (defrule
  2257.     (building-type-count castle == 0)
  2258.     (can-train militiaman-line)
  2259.     (or
  2260.         (population < deathmatch-unit-max)
  2261.         (and
  2262.             (population < unit-max)
  2263.             (goal need-deathmatch-villagers NO)
  2264.         )
  2265.     )
  2266.     (not (goal 36 NO) )
  2267. =>
  2268.     (train militiaman-line)
  2269. )
  2270.  
  2271. (defrule
  2272.     (building-type-count castle == 0)
  2273.     (can-train knight-line)
  2274.     (or
  2275.         (population < deathmatch-unit-max)
  2276.         (and
  2277.             (population < unit-max)
  2278.             (goal need-deathmatch-villagers NO)
  2279.         )
  2280.     )
  2281.     (not (goal 37 NO) )
  2282. =>
  2283.     (train knight-line)
  2284. )
  2285.  
  2286. (defrule
  2287.     (building-type-count castle == 0)
  2288.     (can-train cavalry-archer-line)
  2289.     (or
  2290.         (population < deathmatch-unit-max)
  2291.         (and
  2292.             (population < unit-max)
  2293.             (goal need-deathmatch-villagers NO)
  2294.         )
  2295.     )
  2296.     (not (goal 38 NO) )
  2297. =>
  2298.     (train cavalry-archer-line)
  2299. )
  2300.  
  2301. (defrule
  2302.     (building-type-count castle == 0)
  2303.     (can-train archer-line)
  2304.     (not (unit-available hand-cannoneer) )
  2305.     (or
  2306.         (population < deathmatch-unit-max)
  2307.         (and
  2308.             (population < unit-max)
  2309.             (goal need-deathmatch-villagers NO)
  2310.         )
  2311.     )
  2312.     (not (goal 39 NO) )
  2313. =>
  2314.     (train archer-line)
  2315. )
  2316.  
  2317. (defrule
  2318.     (building-type-count castle == 0)
  2319.     (can-train hand-cannoneer)
  2320.     (or
  2321.         (population < deathmatch-unit-max)
  2322.         (and
  2323.             (population < unit-max)
  2324.             (goal need-deathmatch-villagers NO)
  2325.         )
  2326.     )
  2327.     (not (goal 39 NO) )
  2328. =>
  2329.     (train hand-cannoneer)
  2330. )
  2331.  
  2332. (defrule
  2333.     (can-train my-unique-unit-line)
  2334.     (or
  2335.         (population < deathmatch-unit-max)
  2336.         (and
  2337.             (population < unit-max)
  2338.             (goal need-deathmatch-villagers NO)
  2339.         )
  2340.     )
  2341. =>
  2342.     (train my-unique-unit-line)
  2343.     (set-goal secondary-build 1)
  2344. )
  2345.  
  2346. ; monks
  2347. (defrule
  2348.     (unit-type-count my-unique-unit-line > ten-percent-pop)
  2349.     (unit-type-count-total monk == 0)
  2350.     (goal monk-rating POOR)
  2351.     (can-train monk)
  2352. =>
  2353.     (train monk)
  2354. )
  2355.  
  2356. (defrule
  2357.     (unit-type-count my-unique-unit-line > ten-percent-pop)
  2358.     (unit-type-count-total monk < five-percent-pop)
  2359.     (goal monk-rating FAIR)
  2360.     (can-train monk)
  2361. =>
  2362.     (train monk)
  2363. )
  2364.  
  2365. (defrule
  2366.     (unit-type-count my-unique-unit-line > ten-percent-pop)
  2367.     (unit-type-count-total monk < ten-percent-pop)
  2368.     (goal monk-rating GOOD)
  2369.     (can-train monk)
  2370. =>
  2371.     (train monk)
  2372. )
  2373. ;*********************************************
  2374. ;BLACKSMITH
  2375. ;first level upgrades
  2376. (defrule
  2377.     (can-research ri-forging)
  2378.     (nand
  2379.         (goal 36 NO)
  2380.         (goal 37 NO)
  2381.     )
  2382. =>
  2383.     (research ri-forging)
  2384. )
  2385.  
  2386. (defrule
  2387.     (can-research ri-fletching)
  2388.     (or
  2389.         (nand
  2390.             (goal 38 NO)
  2391.             (goal 39 NO)
  2392.         )
  2393.         (or
  2394.             (building-type-count-total watch-tower > 0)
  2395.             (unit-type-count-total war-galley > 0)
  2396.         )
  2397.     )
  2398. =>
  2399.     (research ri-fletching)
  2400. )
  2401.  
  2402. (defrule
  2403.     (can-research ri-padded-archer-armor)
  2404.     (nand
  2405.         (goal 38 NO)
  2406.         (goal 39 NO)
  2407.     )
  2408. =>
  2409.     (research ri-padded-archer-armor)
  2410. )
  2411.  
  2412. (defrule
  2413.     (can-research ri-scale-mail)
  2414.     (not (goal 36 NO) )
  2415. =>
  2416.     (research ri-scale-mail)
  2417. )
  2418.  
  2419. (defrule
  2420.     (can-research ri-scale-barding)
  2421.     (not (goal 37 NO) )
  2422. =>
  2423.     (research ri-scale-barding)
  2424. )
  2425.  
  2426. ;second upgrades
  2427. (defrule
  2428.     (can-research ri-iron-casting)
  2429.     (nand
  2430.         (goal 36 NO)
  2431.         (goal 37 NO)
  2432.     )
  2433. =>
  2434.     (research ri-iron-casting)
  2435. )
  2436.  
  2437. (defrule
  2438.     (can-research ri-bodkin-arrow)
  2439.     (or
  2440.         (nand
  2441.             (goal 38 NO)
  2442.             (goal 39 NO)
  2443.         )
  2444.         (or
  2445.             (building-type-count-total watch-tower > 0)
  2446.             (unit-type-count-total war-galley > 0)
  2447.         )
  2448.     )
  2449. =>
  2450.     (research ri-bodkin-arrow)
  2451. )
  2452.  
  2453. (defrule
  2454.     (can-research ri-leather-archer-armor)
  2455.     (nand
  2456.         (goal 38 NO)
  2457.         (goal 39 NO)
  2458.     )
  2459. =>
  2460.     (research ri-leather-archer-armor)
  2461. )
  2462.  
  2463. (defrule
  2464.     (can-research ri-chain-mail)
  2465.     (not (goal 36 NO) )
  2466. =>
  2467.     (research ri-chain-mail)
  2468. )
  2469.  
  2470. (defrule
  2471.     (can-research ri-chain-barding)
  2472.     (not (goal 37 NO) )
  2473. =>
  2474.     (research ri-chain-barding)
  2475. )
  2476.  
  2477. ;third upgrades
  2478. (defrule
  2479.     (can-research ri-blast-furnace)
  2480.     (nand
  2481.         (goal 36 NO)
  2482.         (goal 37 NO)
  2483.     )
  2484. =>
  2485.     (research ri-blast-furnace)
  2486. )
  2487.  
  2488. (defrule
  2489.     (can-research ri-bracer)
  2490.     (or
  2491.         (nand
  2492.             (goal 38 NO)
  2493.             (goal 39 NO)
  2494.         )
  2495.         (or
  2496.             (building-type-count-total watch-tower > 0)
  2497.             (unit-type-count-total war-galley > 0)
  2498.         )
  2499.     )
  2500. =>
  2501.     (research ri-bracer)
  2502. )
  2503.  
  2504. (defrule
  2505.     (can-research ri-ring-archer-armor)
  2506.     (nand
  2507.         (goal 38 NO)
  2508.         (goal 39 NO)
  2509.     )
  2510. =>
  2511.     (research ri-ring-archer-armor)
  2512. )
  2513.  
  2514. (defrule
  2515.     (can-research ri-plate-mail)
  2516.     (not (goal 36 NO) )
  2517. =>
  2518.     (research ri-plate-mail)
  2519. )
  2520.  
  2521. (defrule
  2522.     (can-research ri-plate-barding)
  2523.     (not (goal 37 NO) )
  2524. =>
  2525.     (research ri-plate-barding)
  2526. )
  2527.  
  2528. ;SIEGE RESEARCH ITEMS
  2529. (defrule
  2530.     (can-research ri-siege-engineers)
  2531. =>
  2532.     (research ri-siege-engineers)
  2533. )
  2534.  
  2535. (defrule
  2536.     (can-research ri-hoardings)
  2537. =>
  2538.     (research ri-hoardings)
  2539. )
  2540.  
  2541. (defrule
  2542.     (not (goal 1 0) )
  2543.     (can-research ri-heated-shot)
  2544. =>
  2545.     (research ri-heated-shot)
  2546. )
  2547.  
  2548. (defrule
  2549.     (building-type-count-total watch-tower > 2)
  2550.     (can-research ri-guard-tower)
  2551. =>
  2552.     (research ri-guard-tower)
  2553. )
  2554.  
  2555. (defrule
  2556.     (building-type-count-total guard-tower > 2)
  2557.     (can-research ri-keep)
  2558. =>
  2559.     (research ri-keep)
  2560. )
  2561.  
  2562. (defrule
  2563.     (can-research ri-bombard-tower)
  2564. =>
  2565.     (research ri-bombard-tower)
  2566. )
  2567.  
  2568. (defrule
  2569.     (goal wall-build YES)
  2570.     (can-research ri-fortified-wall)
  2571. =>
  2572.     (research ri-fortified-wall)
  2573. )
  2574.  
  2575. ;SHIPS
  2576. (defrule
  2577.     (not (goal 1 0) )
  2578.     (can-research ri-careening)
  2579. =>
  2580.     (research ri-careening)
  2581. )
  2582.  
  2583. (defrule
  2584.     (not (goal 1 0) )
  2585.     (can-research ri-dry-dock)
  2586. =>
  2587.     (research ri-dry-dock)
  2588. )
  2589.  
  2590. (defrule
  2591.     (not (goal 1 0) )
  2592.     (can-research ri-shipwright)
  2593. =>
  2594.     (research ri-shipwright)
  2595. )
  2596.  
  2597. ;OTHER RESEARCH ITEMS
  2598. (defrule
  2599.     (can-research ri-ballistics)
  2600. =>
  2601.     (research ri-ballistics)
  2602. )
  2603.  
  2604. (defrule
  2605.     (can-research ri-chemistry)
  2606. =>
  2607.     (research ri-chemistry)
  2608. )
  2609.  
  2610. (defrule
  2611.     (can-research ri-conscription)
  2612. =>
  2613.     (research ri-conscription)
  2614. )
  2615.  
  2616. ;***********************************
  2617. ;ECONOMIC UPGRADES
  2618. ;***********************************
  2619. ;mining-camp items
  2620. (defrule
  2621.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2622.     (can-research ri-gold-mining)
  2623. =>
  2624.     (research ri-gold-mining)
  2625. )
  2626.  
  2627. (defrule
  2628.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2629.     (can-research ri-gold-shaft-mining)
  2630. =>
  2631.     (research ri-gold-shaft-mining)
  2632. )
  2633.  
  2634. (defrule
  2635.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2636.     (research-completed ri-gold-mining)
  2637.     (can-research ri-stone-mining)
  2638. =>
  2639.     (research ri-stone-mining)
  2640. )
  2641.  
  2642. (defrule
  2643.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2644.     (research-completed ri-gold-shaft-mining)
  2645.     (can-research ri-stone-shaft-mining)
  2646. =>
  2647.     (research ri-stone-shaft-mining)
  2648. )
  2649.  
  2650. ;university stuff
  2651. (defrule
  2652.     (can-research ri-masonry)
  2653. =>
  2654.     (research ri-masonry)
  2655. )
  2656.  
  2657. (defrule
  2658.     (can-research ri-architecture)
  2659. =>
  2660.     (research ri-architecture)
  2661. )
  2662.  
  2663. (defrule
  2664.     (can-research ri-stonecutting)
  2665. =>
  2666.     (research ri-stonecutting)
  2667. )
  2668.  
  2669. ;market & town center
  2670. (defrule
  2671.     (can-research ri-town-watch)
  2672. =>
  2673.     (research ri-town-watch)
  2674. )
  2675.  
  2676. (defrule
  2677.     (can-research ri-town-patrol)
  2678. =>
  2679.     (research ri-town-patrol)
  2680. )
  2681.  
  2682. (defrule
  2683.     (player-in-game any-ally)
  2684.     (can-research ri-cartography)
  2685. =>
  2686.     (research ri-cartography)
  2687. )
  2688.  
  2689. (defrule
  2690.     (or
  2691.         (unit-type-count trade-cart > 1)
  2692.         (unit-type-count trade-cog > 1)
  2693.     )
  2694.     (can-research ri-caravan)
  2695. =>
  2696.     (research ri-caravan)
  2697. )
  2698.  
  2699. (defrule
  2700.     (can-research ri-guilds)
  2701. =>
  2702.     (research ri-guilds)
  2703. )
  2704.  
  2705. (defrule
  2706.     (current-age == imperial-age)
  2707.     (can-research ri-loom)
  2708. =>
  2709.     (research ri-loom)
  2710. )
  2711.  
  2712. (defrule
  2713.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2714.     (can-research ri-wheel-barrow)
  2715. =>
  2716.     (research ri-wheel-barrow)
  2717. )
  2718.  
  2719. (defrule
  2720.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2721.     (can-research ri-hand-cart)
  2722. =>
  2723.     (research ri-hand-cart)
  2724. )
  2725.  
  2726. (defrule
  2727.     (player-in-game any-ally)
  2728.     (can-research ri-coinage)
  2729. =>
  2730.     (research ri-coinage)
  2731. )
  2732.  
  2733. (defrule
  2734.     (player-in-game any-ally)
  2735.     (can-research ri-banking)
  2736. =>
  2737.     (research ri-banking)
  2738. )
  2739.  
  2740. ;monk upgrades
  2741. (defrule
  2742.     (can-research ri-faith)
  2743.     (or
  2744.         (cc-players-unit-type-count any-enemy monk >= ten-percent-pop)
  2745.         (cc-players-unit-type-count any-enemy monk > 10)
  2746.     )
  2747. =>
  2748.     (research ri-faith)
  2749. )
  2750.  
  2751. (defrule
  2752.     (can-research ri-heresy)
  2753.     (or
  2754.         (cc-players-unit-type-count any-enemy monk > five-percent-pop)
  2755.         (cc-players-unit-type-count any-enemy monk > 5)
  2756.     )
  2757. =>
  2758.     (research ri-heresy)
  2759. )
  2760.  
  2761. (defrule
  2762.     (difficulty <= moderate)
  2763.     (can-research ri-atonement)
  2764.     (or
  2765.         (cc-players-unit-type-count any-enemy monk > five-percent-pop)
  2766.         (cc-players-unit-type-count any-enemy monk > 5)
  2767.     )
  2768. =>
  2769.     (research ri-atonement)
  2770. )
  2771.  
  2772. (defrule
  2773.     (can-research ri-block-printing)
  2774.     (unit-type-count monk > five-percent-pop)
  2775. =>
  2776.     (research ri-block-printing)
  2777. )
  2778.  
  2779. (defrule
  2780.     (can-research ri-illumination)
  2781.     (unit-type-count monk > 1)
  2782. =>
  2783.     (research ri-illumination)
  2784. )
  2785.  
  2786. (defrule
  2787.     (can-research ri-fervor)
  2788.     (unit-type-count monk > 1)
  2789. =>
  2790.     (research ri-fervor)
  2791. )
  2792.  
  2793. (defrule
  2794.     (difficulty <= moderate)
  2795.     (can-research ri-redemption)
  2796.     (unit-type-count monk > five-percent-pop)
  2797. =>
  2798.     (research ri-redemption)
  2799. )
  2800.  
  2801. (defrule
  2802.     (can-research ri-sanctity)
  2803.     (unit-type-count monk > 1)
  2804. =>
  2805.     (research ri-sanctity)
  2806. )
  2807. ;***********************************
  2808. ;MARKET STUFF
  2809. ;***********************************
  2810. (defrule
  2811.     (wood-amount > 5000)
  2812.     (commodity-selling-price wood >= 20)
  2813.     (can-sell-commodity wood)
  2814. =>
  2815.     (chat-local-to-self "abuse market; sell wood")
  2816.     (sell-commodity wood)
  2817. )
  2818.  
  2819. (defrule
  2820.     (food-amount > 5000)
  2821.     (commodity-selling-price food >= 20)
  2822.     (can-sell-commodity food)
  2823. =>
  2824.     (chat-local-to-self "abuse market; sell food")
  2825.     (sell-commodity food)
  2826. )
  2827.  
  2828. (defrule
  2829.     (gold-amount < 1200)
  2830.     (wood-amount > 5000)
  2831.     (can-sell-commodity wood)
  2832. =>
  2833.     (chat-local-to-self "need gold; sell wood")
  2834.     (sell-commodity wood)
  2835. )
  2836.  
  2837. (defrule
  2838.     (gold-amount < 1200)
  2839.     (food-amount > 5000)
  2840.     (can-sell-commodity food)
  2841. =>
  2842.     (chat-local-to-self "need gold; sell food")
  2843.     (sell-commodity food)
  2844. )
  2845.  
  2846. (defrule
  2847.     (gold-amount < 1200)
  2848.     (stone-amount > 1000)
  2849.     (building-type-count-total castle >= 5)
  2850.     (can-sell-commodity stone)
  2851. =>
  2852.     (chat-local-to-self "need gold; sell stone")
  2853.     (sell-commodity stone)
  2854. )
  2855.  
  2856. (defrule
  2857.     (stone-amount < 650)
  2858.     (gold-amount > 5000)
  2859.     (building-type-count-total castle < 5)
  2860.     (can-buy-commodity stone)
  2861. =>
  2862.     (chat-local-to-self "need stone")
  2863.     (buy-commodity stone)
  2864. )
  2865.  
  2866. (defrule
  2867.     (wood-amount < 1100)
  2868.     (gold-amount > 5000)
  2869.     (can-buy-commodity wood)
  2870. =>
  2871.     (chat-local-to-self "need wood")
  2872.     (buy-commodity wood)
  2873. )
  2874.  
  2875. (defrule
  2876.     (food-amount < 1600)
  2877.     (gold-amount > 5000)
  2878.     (can-buy-commodity food)
  2879. =>
  2880.     (chat-local-to-self "need food")
  2881.     (buy-commodity food)
  2882. )
  2883.  
  2884.